<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>

        // 1. 筛选出数组中的偶数项
        const arr = [1, 2, 3, 4, 5, 6, 7];
        const res = arr.filter(function (item) {
            return item % 2 === 0;
        });
        console.log(res);


        // 2. 筛选出数组中年龄大于100的
        const students = [
            {
                name: 'zhangsan',
                age: 18,
            },
            {
                name: 'lisi',
                age: 180,
            },
            {
                name: 'wangwu',
                age: 110,
            },
            {
                name: 'fangyunchuan',
                age: 8,
            },
        ];
        const resStudents = students.filter(function (item) {
            return item.age > 100;
        });
        console.log(resStudents);

    </script>
</body>
</html>